





<div class="admin-biaogelist">




        <div class="searchbox">
            <div class="searchbox_box">
                <div  class="searchbox_text"> 日期选择：</div>
                <div  class="searchbox_input">   <input type="" id="datetimepicker" name="date" class="datapick1" data-date-format="yyyy-mm-dd">
            </div>
            </div>


                <div class="searchbox_box">
                    <div  class="searchbox_text"> 商铺名：</div>
                    <div  class="searchbox_input"><input name="shop_name" type="text" > </div>
                </div>

                <div class="searchbox_box">
                    <div  class="searchbox_text"> 订单号：</div>
                    <div  class="searchbox_input"><input  name="orderid"type="text" > </div>
                </div>
               <div class="searchbox_box">
                <div  class="searchbox_text"> awz：</div>
                <div  class="searchbox_input"><input name="awz" type="text" > </div>
                </div>

            <div class="searchbox_box">
                <div class="search_button  search am-btn am-btn-secondary "> <img src="<?php echo base_url();?>/public/assets/image/chazhao.png">查询 </div>
            </div>

            <div class="searchbox_box">
                <a   style="margin-left: 20px;" class="excelout"  href="<?php echo base_url()."/Hunter/finishlistexcel/2/0"?>"><div class="search_button am-btn am-btn-secondary ">
                <img src="<?php echo base_url();?>/public/assets/image/daochu.png">导出数据

               </div></a>
            </div>

            <div class="searchbox_box">
                <a href="javascript:" class="file" style="color: #0C0C0C">订单上传
                    <input type="file" name="uploadFile" class="uploadPicButton" id="upload_file">
                </a>
            </div>


        </div>





            <div class="fbneirong">
        <form class="am-form am-g">
            <table width="100%" class="am-table am-table-bordered am-table-radius am-table-striped am-table-hover">
                <thead>
                <tr class="am-success">
                    <th class="table-check"><input type="checkbox" /></th>

                    <th class="table-id">编号</th>
                    <th class="table-type">类型</th>
                    <th class="table-type"  style="width: 150px;" >处理时间</th>
                    <th class="table-type">店铺名称</th>
                    <th class="table-type">每单件数</th>
                    <th class="table-type">关键字</th>
                    <th class="table-type">隔夜</th>
                    <th class="table-author am-hide-sm-only">录入价格</th>
                    <th class="table-type am-hide-sm-only" style="width: 200px;">订单号</th>
                    <th class="table-type" style="width: 100px;">实际付款</th>
                <!--    <th class="table-type">付款总额</th>-->
                    <th class="table-date am-hide-sm-only" style="width: 100px;">awz标示</th>
                    <th class="table-date am-hide-sm-only">操作</th>
                </tr>
                </thead>
                <tbody class="impowdith">





                </tbody>
            </table>




            <div id="Pagination" style="margin:20px auto" style="display:none"></div>







        </form>

            </div>

    </div>



    <script>




        laydate.render({
            elem: '.datapick1'
        });


        var on_request=false;
        var type=1;
        var page=1;


        $(".uploadPicButton").change(function () {
            var pic = $('#upload_file')[0].files[0];
            var fd = new FormData();
            fd.append('uploadFile', pic);
            var url = "<?php echo base_url(); ?>/Hunter/excelToArray";

            $.ajax({
                url:url,
                type:"post",
                dataType:"json",
                // Form数据
                data: fd,
                cache: false,
                contentType: false,
                processData: false,
                success:function(data){
                    layer.msg(data.msg,function () {
                        window.location.reload();
                    });

                }
            });
        });



   $(".search").click(function () { page=1;
            getjdfinishlist()
        });



        function setlisthtnml(data) {
            var html="";
            /*  <a class="am-btn am-btn-default am-btn-xs am-text-success am-round am-icon-file" data-am-modal="{target: '#my-popups'}" title="添加子栏目"></a>*/

            if(data.list.length>0){
                $.each(data.list, function (key, value) {
                     var setcolor="";
                    if(value.update!=null){
                        setcolor="setcolor";
                    }
                    if(value.overnight!=1){
                        value.overnight="";
                    }

                    html=html+
                        '<tr  listid="'+value.id+'"   ><td><input type="checkbox" /></td>\n'+
                        '<td>'+value.id+'</td>\n'+
                        '<td>'+value.type_hname+'</td>\n'+
                        '<td>'+value.finishtime+'</td>\n'+

                        '<td>'+value.shop_name+'</td>\n'+
                        '<td>'+value.number+'</td>\n'+
                        '<td>'+value.key_word+'</td>\n'+
                        '<td>'+value.overnight+'</td>\n'+
                        '<td>'+value.price+'</td>\n'+
                        '   <td > <input name="orderid"   value="'+value.orderid+'"  class="'+setcolor+'"    style="width: 100%" ></td>'+
                        '   <td > <input name="real_price"   value="'+value.real_price+'"  style="width: 40%; margin-left: 10px;" ></td>'+
                        '   <td > <input name="awz"   value="'+value.awz+'"  style="width: 40%; margin-left: 10px;" ></td>'+
                      /*  '<td>'+value.awz+'</td>\n'+*/
                        '<td>'+'<div  class="am-btn am-btn-secondary edite">修改</div>'+'</td>\n'+

                        '</tr>';
                });
                $(".impowdith").html(html);
                $('#Pagination').show();

                edite();


            }else{
                html += '<li><div style="width:100%;text-align:center;">&nbsp暂无数据</div></li>';
                $(".impowdith").html(html);
                $('#Pagination').hide();
            }
        }



        function edite(){
            $(".edite").click(function () {
               if( on_request){
                    alert("请不要频繁操作"); return;
                }
                var id=$(this).parents("tr").attr("listid");
                var orderid=$(this).parents("tr").find("input[name='orderid']").val();
                var real_price=$(this).parents("tr").find("input[name='real_price']").val();
                var awz=$(this).parents("tr").find("input[name='awz']").val();

                var r=confirm("确认修改该记录?");
                 if(!r){
                       return;
                   }
                var url = "<?php echo base_url(); ?>/hunter/JdEdite";
                var postdata = {
                    'id': id,
                    'orderid': orderid,
                    'awz': awz,
                    'real_price': real_price
                };
                 on_request=true;
                $.post(url, postdata, function (data) {
                      on_request = false;
                    if(data.code==0){
                        alert("修改成功"); return;
                    }
                    alert(data.msg);
                },'json');


            });
        }








        getjdfinishlist();
        function getjdfinishlist() {
            var url = "<?php echo base_url(); ?>/hunter/getpddfinishlist";
            var orderid=$("input[name='orderid']").val();
            var date=$("input[name='date']").val();
            var awz=$("input[name='awz']").val();
            var shop_name=$("input[name='shop_name']").val();

            var postdata = {
                'page': page,
                'orderid': orderid,
                'awz': awz,
                'shop_name': shop_name,
                'date': date,
                'epage': 10
            };
            $.post(url, postdata, function (data) {
                setlisthtnml(data);
                setPagination("Pagination", data.count, page, data.epage, function (clickPage) {
                    page = parseInt(clickPage) + 1;
                    getjdfinishlist();
                });
            },'json');

        }





    </script>














<!--<script src="http://libs.baidu.com/jquery/1.11.1/jquery.min.js"></script>-->
<script src="http://cdn.staticfile.org/modernizr/2.8.3/modernizr.js"></script>
<script src="<?php echo base_url() . 'public/business/'; ?>assets/js/polyfill/rem.min.js"></script>
<script src="<?php echo base_url() . 'public/business/'; ?>assets/js/polyfill/respond.min.js"></script>
<script src="<?php echo base_url() . 'public/business/'; ?>assets/js/amazeui.legacy.js"></script>


<!--[if (gte IE 9)|!(IE)]><!-->
<script src="<?php echo base_url() . 'public/business/'; ?>assets/js/amazeui.min.js"></script>
<!--<![endif]-->



</body>
</html>